package com.example.qingyiapp.ui.activity.fragment.fragment_MenuUI;


import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.qingyiapp.R;
import com.example.qingyiapp.ui.activity.fragment.fragment_MenuUI.Childfragment.Login_child_fragment;
import com.example.qingyiapp.ui.activity.fragment.fragment_MenuUI.LoginAdapter.Login_fragment_adpter;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;


/**
 * A simple {@link Fragment} subclass.
 */
public class Fragment_MenuUI extends Fragment {

    Unbinder unbinder;
    @BindView(R.id.login_tab)
    TabLayout loginTab;
    @BindView(R.id.login_vp)
    ViewPager loginVp;

    ArrayList<String> strings = new ArrayList<>();
    ArrayList<Fragment> fragments = new ArrayList<>();
    public Fragment_MenuUI() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View inflate = inflater.inflate(R.layout.fragment_fragment__menu_ui, container, false);
        unbinder = ButterKnife.bind(this, inflate);
        strings.clear();
        fragments.clear();
        strings.add("全部");
        strings.add("游记");
        strings.add("问答");
        strings.add("攻略");
        fragments.add(new Login_child_fragment());
        fragments.add(new Login_child_fragment());
        fragments.add(new Login_child_fragment());
        fragments.add(new Login_child_fragment());
        Login_fragment_adpter login_fragment_adpter = new Login_fragment_adpter(getChildFragmentManager(), strings, fragments);
        loginVp.setAdapter(login_fragment_adpter);
        loginTab.setupWithViewPager(loginVp);
        return inflate;
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
    }


}
